﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Moxiecode.TinyMCE.Settings
{
    public class SettingFormatter : IFormatProvider, ICustomFormatter
    {
        public object GetFormat(Type formatType)
        {
            return (formatType == typeof(ICustomFormatter)) ? this : null;
        }

        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            if (format == null)
            {
                return String.Format("{0}", arg);
            }
            return (format.StartsWith("L")) ? Convert.ToString(arg).ToLower() : Convert.ToString(arg);
        }
    }
}
